<!DOCTYPE html>
<html>

<head>
    <title>Example</title>
    <meta name="author" content="Adam Freeman">
    <meta name="description" content="A simple example">
    <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon">
</head>
<style type="text/css">
    /* postion 定位 left right top bottom 为元素设置偏移量 
    z-index 设置定位元素的层叠顺序 
      postion ---static;relative;absolute;fixed
    */
    img {
        top: 30px;
        left: 150px;
        border: medium double black;
    }
</style>

<body>
    <!-- 可以使用float属性创建浮动盒，浮动盒会将元素的左边界或者右边界移动到包含块
    或另一个浮动盒的边界 -->
    <p>
        There are lots of different kinds of fruit - there are over 500 varieties
        of banana alone. By the time we add the countless types of apples, oranges,
        and other well-known fruit, we are faced with thousands of choides.
    </p>
    <p>
        One of the most interesting aspects of fruit is the variety available in
        each country. <span>I live near London</span>, in an area which is known for
        its apples.
    </p>
    <img id="banana" src="../images/banana.png" alt="small banana">
    <p>
        When travelling in Asia, I was struck by how many different kinds of banana were available - many of which had
        unique flavours and which were only avaiable within a small region.
    </p>
    <p>
        <button>Static</button>
        <!-- 元素就将沿水平轴向右偏移150px，向下偏移30px  相对static-->
        <button>Relative</button>
        <!-- 本例相对于body -->
        <button>Absolute</button>
        <!-- 跟着窗口爬来爬去 -->
        <button>fixed</button>
    </p>
    <script>
        var buttons = document.getElementsByTagName("button");
        for (var i = 0; i < buttons.length; i++) {
            buttons[i].onclick = function (e) {
                document.getElementById("banana").style.position = 
                e.target.innerHTML;
            };
        }
    </script>
</body>

</html>